package com.tdf.lolpanel.mapper;

import com.tdf.lolpanel.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
public interface UserMapper {

    /**
     * 根据用户名查询
     */
    @Select("SELECT * FROM user WHERE username= #{username}")
    User getByUsername(String username);
//    User getByUsername(@Param("username") String username);

    /**
     * 加入用户
     */
    @Insert("INSERT INTO user (username, password, lolname, phone, status, createdTime, updatedTime) " +
            "VALUES " +
            "(#{username},#{password},#{lolname},#{phone},#{phone},#{createdTime},#{updatedTime})")
    void insert(User user);
}
